<template>
    <div class="app-container">
        <!-- 添加或修改定位器对话框 -->
        <com-dialog :cstyle="'height:150px'" :title="title" :visible="open" :width="'500px'" :footer="false"
            @update:visible="(v) => { this.open = v }">
            <div slot="content">
                <el-form ref="form" :model="form" :rules="rules" label-width="100px">
                    <el-form-item prop="gonghao">
                        <template slot="label">
                            延迟时间 <i class="el-icon-question"></i>
                        </template>
                        <el-input v-model="form.gonghao" placeholder="请输入延迟时间" />
                    </el-form-item>
                    <el-form-item label="执行次数" prop="phone">
                        <el-input v-model="form.phone" placeholder="请输入执行次数" />
                    </el-form-item>
                </el-form>
            </div>
            <div slot="footer" class="dialog-footer">
                <el-button type="primary" @click="submitForm">确 定</el-button>
                <el-button type="primary" @click="cancel">取 消</el-button>
            </div>
        </com-dialog>
    </div>
</template>
  
<script>
import ComDialog from "@/components/ComDialog";
export default {
    components: { ComDialog },
    name: "GpsLocatorInfoOpt",
    data() {
        return {
            // 弹出层标题
            title: "",
            // 是否显示弹出层
            open: false,
            // 表单参数
            form: {},
            // 表单校验
            rules: {
                deptId_dictText: [
                    { required: true, message: "延迟时间不能为空", trigger: "blur" }
                ],
                riskPointLocation: [
                    { required: true, message: "执行次数不能为空", trigger: "blur" }
                ],

            }
        };
    },
    created() {

    },
    methods: {
        // 取消按钮
        cancel() {
            this.open = false;
            this.reset();
        },
        // 表单重置
        reset() {
            this.form = {

            };
            this.$forceUpdate();
        },
        /** 新增按钮操作 */
        handleTest() {
            this.open = true;
            this.$forceUpdate();
            this.reset();
            this.title = "测试运行";
        },

        /** 提交按钮 */
        submitForm() {
            let _this = this;
            this.$refs["form"].validate(valid => {
                if (valid) {
                    if (_this.form.id != null) {
                        this.$message.success('修改成功')
                    } else {
                        this.$message.success('新增成功')
                    }
                    this.open = false;
                }
            });
        }
    }
};
</script>
<style lang="less"></style>